<template>
    <div class="jianzhan-content">
        <Crumb name="Point Code"></Crumb>
        <div class="content">
            <div class="table-wrapper">
                <el-table
                        :data="pointList.slice((pageNum-1)*pageSize,pageNum*pageSize)"
                        style="width: 100%">
                    <el-table-column
                            prop="category"
                            label="category"
                            >
                    </el-table-column>
                    <el-table-column
                            prop="description"
                            label="description"
                            >
                    </el-table-column>
                    <el-table-column
                            prop="hours"
                            label="hours">
                    </el-table-column>
                    <el-table-column
                            prop="pointCode"
                            label="pointCode">
                    </el-table-column>
                    <el-table-column
                            prop="unit"
                            label="unit">
                    </el-table-column>
                </el-table>
                <div class="page">
                    <el-pagination background
                                   :page-size="pageSize"
                                   @current-change="changePage"
                                   layout="prev, pager, next"
                                   :total="total">
                    </el-pagination>
                </div>

            </div>
        </div>
    </div>
</template>

<script>
    import Crumb from '../../components/common/crumb'
    import {getPointList} from "../../api/service";
    import mixins from '../../util/mixins'
    import {ERROR_OK} from "../../util/config";

    export default {
        name: "point-code",
        mixins:[mixins],
        data(){
            return {
                pointList:[]
            }
        },
        created(){
            this.getPointList()
        },
        methods:{
            async getPointList(){
                const {status,data} = await getPointList();
                if (status === ERROR_OK) {
                    this.pointList = data;
                    this.total = data.length
                }
            }
        },
        components:{
            Crumb
        }
    }
</script>

<style scoped lang="scss">
 @import "../../css/mixins";
    .content{
        @include content
    }
</style>